;
var storagy_index_ops={
    init:function () {
        console.log("初始化.....");
        this.eventBind();
    },
    eventBind:function () {
        var that = this;//this指针的作用域会变化
        console.log("执行搜索功能.....")
        $(".wrap_search .search").click(function () {
            $(".wrap_search").submit()//jQuery方法
        });
        //处理删除
        $(".remove").click(function () {
            that.ops("remove",$(this).attr("data"));
        });
        //处理撤销
        $('.recover').click(function () {
            that.ops("recover",$(this).attr("data"))
        })
    },
    ops:function (act, id) {
        var callback = {
            'ok':function () {
                //Ajax调用传递给后端
                $.ajax({
                url:common_ops.buildUrl('/storagy/ops'),
                type:'POST',
                data:{
                    act:act,
                    id:id
                },
                dataType:'json',
                success:function (res) {
                    var callback = null;
                    if(res.code == 200)
                    {
                        callback=function () {
                            window.location.href = window.location.href;//刷新当前页面
                        }
                    }
                    common_ops.alert(res.msg, callback);
                }
        })
            },
            'cancel':null
        };
        common_ops.confirm((act == "remove" ? "确定删除？":"确定恢复"),callback)
    }
};
//文档就绪事件
$(document).ready(function () {
   console.log("index页面文件已经就绪.....")
   storagy_index_ops.init()
});